package processor.impl;

import java.util.Comparator;
import java.util.List;
import java.util.Set;

import analyser.Analyser;
import analyser.impl.AnalyserImpl;
import pojo.Customer;
import printer.Printer;
import printer.impl.PrinterImpl;
import processor.Processor;

public class ProcessorImpl implements Processor {
	
	private String format;
	private Analyser analyser;
	private Printer printer;
	private List<Customer> list;

	public ProcessorImpl(List<Customer> list, String format) {
		// TODO Auto-generated constructor stub
		this.list = list;
		this.format = format;
		analyser = new AnalyserImpl(list);
		printer = new PrinterImpl();
	}

	public StringBuilder process(Comparator<Customer> comparator) {
		// TODO Auto-generated method stub
		Set<Customer> set = analyser.analyse(comparator);
		
		StringBuilder sb = printer.print(set, format);
		return sb;
	}

}
